class Solution
{
public:
    // 清奇的脑回路题
    int makeTheIntegerZero(int num1, int num2)
    {
        if (num2 > num1)
        {
            return -1;
        }

        long long num1L = num1;
        long long num2L = num2;

        for (int i = 1; i < 10000; ++i)
        {
            long long target = num1L - i * num2L;

            if (target <= 0)
            {
                return -1;
            }

            if (__builtin_popcountl(target) <= i && i <= target) // 比赛时就差 i <= target 的条件
            {
                return i;
            }
        }

        return -1;
    }
};